class WuLiWuTi {
	bianHao = ''
	mingZi= ''
	shiJie = null // 物理世界
	
	static wuLiWuTiShuZu = [] // 全部物理物体
	
	constructor() {}
	
	// 用编号获取物理物体
	static huoQuWuLiWuTi(bianHao) {
		for (let i = 0, il = WuLiWuTi.wuLiWuTiShuZu.length; i < il; i++) {
			let wlwt = WuLiWuTi.wuLiWuTiShuZu[i]
			if (wlwt.bianHao == bianHao) return wlwt
		}
	}
	// 设置物体
	static sheZhiWuTi(canShu) {
		let wlwt = WuLiWuTi.huoQuWuLiWuTi(canShu.bianHao)
		if (wlwt) wlwt.sheZhiWuTi(canShu)
	}
	// 编辑形状
	static bianJiXingZhuang(canShu) {
		let wlwt = WuLiWuTi.huoQuWuLiWuTi(canShu.bianHao)
		if (wlwt) wlwt.bianJiXingZhuang(canShu)
	}
	// 移除物体
	static yiChuWuTi(canShu) {
		let suoYin = -1
		for (let i = 0, il = WuLiWuTi.wuLiWuTiShuZu.length; i < il; i++) {
			let wlwt = WuLiWuTi.wuLiWuTiShuZu[i]
		
			if (wlwt.bianHao == canShu.bianHao) {
				suoYin = i
				wlwt.xiaoHuiWuTi()
				break
			}
		}
		if (suoYin > -1) WuLiWuTi.wuLiWuTiShuZu.splice(suoYin, 1)
	}
}

export {
	WuLiWuTi
}